package com.roncoo.education.course.service.auth;

import javax.validation.constraints.NotNull;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.roncoo.education.common.config.ThreadContext;
import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.common.core.base.Result;
import com.roncoo.education.course.service.auth.biz.AuthUserExperimentBiz;
import com.roncoo.education.course.service.auth.req.AuthUserExperimentReq;
import com.roncoo.education.course.service.auth.resp.AuthExperimentResp;
import com.roncoo.education.course.service.auth.resp.AuthUserExperimentResp;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;

/**
 * AUTH-实验用户关联表
 *
 * @author wujing
 * @date 2022-08-25
 */
@Api(tags = "AUTH-实验用户关联表")
@RestController
@RequiredArgsConstructor
@RequestMapping("/course/auth/user/experiment")
public class AuthUserExperimentController {

    @NotNull
    private final AuthUserExperimentBiz biz;

    /**
     * 实验管理
     *
     * @author fengyw
     */
    @ApiOperation(value = "我的实验分页", notes = "根据条件进行实验分页")
    @RequestMapping(value = "/mgn/page", method = RequestMethod.POST)
    public Result<Page<AuthExperimentResp>> listGlForPage(@RequestBody AuthUserExperimentReq req) {
        return biz.listGlForPage(req, ThreadContext.userId());
    }

    /**
     * 实验列表
     * 
     * @param req
     * @return
     */
    @ApiOperation(value = "实验管理分页", notes = "根据条件进行实验分页")
    @RequestMapping(value = "/page", method = RequestMethod.POST)
    public Result<Page<AuthUserExperimentResp>> listForPage(@RequestBody AuthUserExperimentReq req) {
        return biz.listForPage(req, ThreadContext.userId());
    }
}
